package leetcode.code2161;

import java.util.Arrays;

import leetcode.IDebug;

public class Solution implements IDebug {
	public int[] pivotArray(int[] nums, int pivot) {
		int len = nums.length;
		int[] ans = new int[len];
		int l = 0, r = len - 1;
		Arrays.fill(ans, pivot);
		for (int i = 0; i < len; i++) {
			int num = nums[i];
			if (num < pivot) {
				ans[l++] = num;
			}
		}
		for (int i = len - 1; i >= 0; i--) {
			int num = nums[i];
			if (num > pivot) {
				ans[r--] = num;
			}
		}
		return ans;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
